<?php

namespace app\api\controller;

use think\Controller;
use think\Request;

class Upload extends BaseApi
{

    /**
     * 上传图片到uploads目录
     * @desc
     * @author 16
     * @date 2018/2/8
     */
    public function uploadImg()
    {
        $file = request()->file('file');
        $info = $file->move( './public/uploads');
        if($info){
            $data['imgUrl'] = './public/uploads/'.$info->getSaveName();
        }else{
            $info = $file->getError();
        }

        return $this->ajax(0,$info,$data);
    }

}
